﻿<!doctype html>
<html>
<head>
<meta charset="utf-8">

<title>键盘提交留言</title>
<style>
*{ margin:0; padding:0; list-style:none; font-family: "微软雅黑","张海山锐线体简"}

</style>
<script>
window.onload=function(){
	var oT1=document.getElementById('txt1');
	var oBtn=document.getElementById('btn1');
	var oTa=document.getElementById('ta1');	
	oBtn.onclick=function(){
		oTa.value=oTa.value+'\n'+oT1.value;
		oT1.value='';	
	};
	oT1.onkeydown=function(ev){
		var oEvt=ev||event;
		//console.log(oEvt.keyCode);
		console.log(oEvt);
		if(oEvt.keyCode==13 && oEvt.ctrlKey==true){
			oTa.value=oTa.value+'\n'+oT1.value;
			oT1.value='';
		}
	};
};
</script>
</head>

<body>

<textarea type="text" style="width:200px;height:50px;" id="txt1"></textarea>
<input type="button" value="提交" id="btn1"><br>
<textarea id="ta1" style="width:400px;height:120px;"></textarea>

</body>
</html>
